package com.cpos.cposcommon.interceptor;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/*
 *  @创建人  Leiwenlong
 *  @创建时间 2020/11/29
 *  @描述  MVC 设置
 */
@Configuration
public class WebMvcConfig extends WebMvcConfigurerAdapter {

        @Bean
        public AccessTokenVerifyInterceptor tokenVerifyInterceptor() {
            return new AccessTokenVerifyInterceptor();
        }
        @Override
        public void addInterceptors(InterceptorRegistry registry) {
            registry.addInterceptor(tokenVerifyInterceptor()).addPathPatterns("/test");
            super.addInterceptors(registry);
        }
}
